import json

from pymysql import Connection

if __name__ == '__main__':
    conn = Connection(
        host='127.0.0.1',
        port=3306,
        user='root',
        passwd='123456',
        autocommit=True
    )

    print(conn.get_server_info())

    cursor = conn.cursor()
    conn.select_db("study")
    cursor.execute("select * from users")
    result: tuple = cursor.fetchall()
    for row in result:
        print(row)

    conn.close()
